<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddIndexProjectTaskPlanTimeInDelayOrderTaskTable extends AbstractMigration
{
    public function up()
    {
        $this->table('delay_order_task')
            ->addIndex(['task_id'], ['type' => 'normal', 'name' => 'idx_task'])
            ->addIndex(['project_id'], ['type' => 'normal', 'name' => 'idx_project'])
            ->addIndex(['step_category_id'], ['type' => 'normal', 'name' => 'idx_step_category'])
            ->addIndex(['episode_id'], ['type' => 'normal', 'name' => 'idx_episode'])
            ->addIndex(['original_plan_time'], ['type' => 'normal', 'name' => 'idx_original_plan_time'])
            ->addIndex(['plan_delivery_time'], ['type' => 'normal', 'name' => 'idx_plan_delivery_time'])
            ->addIndex(['delay_time'], ['type' => 'normal', 'name' => 'idx_delay_time'])
            ->save();
    }

    public function down()
    {
        $this->table('delay_order_task')
            ->removeIndexByName('idx_task')
            ->removeIndexByName('idx_project')
            ->removeIndexByName('idx_step_category')
            ->removeIndexByName('idx_episode')
            ->removeIndexByName('idx_original_plan_time')
            ->removeIndexByName('idx_plan_delivery_time')
            ->removeIndexByName('idx_delay_time')
            ->save();
    }
}
